﻿<RibbonWindow 
	x:Class="Sidvall.IdentityManager.UI.Wpf.MainWindow"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:b="clr-namespace:Sidvall.UI.Wpf.Controls;assembly=Sidvall.UI.Wpf" 
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	mc:Ignorable="d"
	xmlns:vms="clr-namespace:Sidvall.IdentityManager.UI.ViewModels;assembly=Sidvall.IdentityManager.UI"
	xmlns:Converters="clr-namespace:Sidvall.UI.Wpf.Converters;assembly=Sidvall.UI.Wpf" 
	Title="{Binding Title}" Height="400" Width="600" Closing="Window_Closing" WindowStartupLocation="CenterScreen" Icon="Application.ico">

	<Window.Resources>
		<Converters:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
		<Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
		<Converters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter2" Not="True" />
	</Window.Resources>
	<Window.InputBindings>
		<KeyBinding Modifiers="Alt" Key="Left" Command="{Binding ToolViewModel.GoBackCommand}" />
		<KeyBinding Modifiers="Alt" Key="Right" Command="{Binding ToolViewModel.GoForwardCommand}" />
		<KeyBinding Key="F5" Command="{Binding ToolViewModel.RefreshCommand}" />
	</Window.InputBindings>

	<Grid d:DataContext="{d:DesignInstance IsDesignTimeCreatable=True, Type={x:Type vms:MainWindowViewModel}}">
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>

		<Ribbon DataContext="{Binding ToolViewModel, Mode=OneWay}">
			<RibbonTab Header="Home" KeyTip="H">
				<RibbonGroup Header="Navigation" IsEnabled="{Binding IsNotBusyAndStarted}">
					<RibbonButton Label="Back" LargeImageSource="/Sidvall.IdentityManager.UI.Wpf;component/Images/Back.png" 
								  Command="{Binding GoBackCommand}" IsEnabled="{Binding CanGoBack}"
								  ToolTipTitle="Go Back (Alt+Left)"/>
					<RibbonButton Label="Forward" LargeImageSource="/Sidvall.IdentityManager.UI.Wpf;component/Images/Forward.png" 
								  Command="{Binding GoForwardCommand}" IsEnabled="{Binding CanGoForward}" 
								  ToolTipTitle="Go Forward (Alt+Right)"/>
					<RibbonButton Label="Refresh" LargeImageSource="/Sidvall.IdentityManager.UI.Wpf;component/Images/Refresh.png" 
								  Command="{Binding RefreshCommand}" IsEnabled="{Binding CanRefresh}" 
								  ToolTipTitle="Refresh (F5)"/>
				</RibbonGroup>
				<RibbonGroup Header="Tools" IsEnabled="{Binding IsNotBusyAndStarted}">
					<RibbonButton Label="Settings" LargeImageSource="/Sidvall.IdentityManager.UI.Wpf;component/Images/UserConfiguration.png" 
								  Command="{Binding ShowUserConfigurationCommand}" />
				</RibbonGroup>
				<RibbonGroup Header="Help" IsEnabled="{Binding IsNotBusyAndStarted}">
					<RibbonButton Label="Information" LargeImageSource="/Sidvall.IdentityManager.UI.Wpf;component/Images/Information.png" 
								  Command="{Binding ShowInformationCommand}"/>
				</RibbonGroup>
			</RibbonTab>
		</Ribbon>
		<Grid Grid.Row="1">
			<b:BusyIndicatorControl HeaderCaption="{Binding IsBusyMessage}" Visibility="{Binding IsBusyAndStarted, Converter={StaticResource BooleanToVisibilityConverter}}" Panel.ZIndex="10" />
			<Grid HorizontalAlignment="Stretch" Margin="0,0,0,4">
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition />
					<RowDefinition Height="Auto" />
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>

				<ContentControl Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" x:Name="HeaderContent" IsEnabled="{Binding IsNotBusy}" />

				<ContentControl Grid.Row="1" Grid.Column="0" x:Name="LeftContent" Panel.ZIndex="1" IsEnabled="{Binding IsNotBusyAndStarted}" />
				<Border Grid.Row="1" Grid.Column="1" BorderThickness="0" Padding="0,0,0,0" IsEnabled="{Binding IsNotBusy}">
					<ContentControl x:Name="CenterContent" />
				</Border>
				<ContentControl Grid.Row="1" Grid.Column="2" x:Name="RightContent" />

				<ContentControl Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3" x:Name="FooterContent" />
			</Grid>
		</Grid>
	</Grid>
</RibbonWindow>
